import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/3/16
 * \* Time: 18:41
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class TestTime {
    public static void main(String[] args) throws ParseException {
        Date ss = new Date();
        Scanner scanner = new Scanner(System.in);

        System.out.println("一般日期输出：" + ss);
        System.out.println("时间戳：" + ss.getTime());
        SimpleDateFormat format0 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date time1 = format0.parse(scanner.nextLine());
        System.out.println("2019-10-25 14:22:22的时间戳："+time1.getTime());
        String time = format0.format(ss.getTime());//这个就是把时间戳经过处理得到期望格式的时间
        System.out.println("格式化结果0：" + time);
        SimpleDateFormat format1 = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
        time = format1.format(ss.getTime());
        System.out.println("格式化结果1：" + time);
    }
}
